package com.startdima.user.infrastructure.vo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

@Setter
@Getter
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class QueryBase {
	
    public static final Integer PAGEDEFAULTCOUNT = 10;
    public static final Integer PAGEDEFAULTNUM = 1;
    public static final String SORTDEFAULT = "asc";
    protected Integer page;
    protected Integer rows;
    protected String sort;
    protected String order;

    public Integer getPage() {
        if (this.page == null || this.page <= 0) {
            this.page = PAGEDEFAULTNUM;
        }

        return this.page;
    }

    public Integer getRows() {
        if (this.rows == null || this.rows <= 0) {
            this.rows = PAGEDEFAULTCOUNT;
        }

        return this.rows;
    }

    public String getSort() {
        if (this.sort == null) {
            this.sort = "asc";
        }

        return this.sort;
    }

}